package com.demo.hc.controller.base;

import com.demo.hc.biz.account.service.UserAccountService;
import com.demo.hc.common.constant.WebConstant;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;

import javax.servlet.http.HttpServletRequest;

public class BaseController {

	protected static final Logger logger = LogManager.getLogger();

	@Autowired
	protected MessageSource messageSource;

	@Autowired
	private UserAccountService userAccountService;

	protected long getUserId(HttpServletRequest request){
		String userId = (String) request.getSession().getAttribute(WebConstant.CURRENT_LOGIN_USER_ID);
		return NumberUtils.toLong(userId);
	}


}
